package userlogic

import (
	"context"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/dao/model/user"

	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/rpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type SetUserValidMarkLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewSetUserValidMarkLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetUserValidMarkLogic {
	return &SetUserValidMarkLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *SetUserValidMarkLogic) SetUserValidMark(in *rpc.SetValidMarkRequest) (*rpc.SetValidMarkResponse, error) {
	if err := user.NewWalletModel(l.ctx, l.svcCtx.Db).SetValidMark(in.UserId, in.ValidMark); err != nil {
		return nil, err
	}
	return &rpc.SetValidMarkResponse{}, nil
}
